//
//  PushNotificationView.m
//  KuWoCan
//
//  Created by 周小宏 on 2017/5/9.
//  Copyright © 2017年 hwd. All rights reserved.
//

#import "PushNotificationView.h"

@interface PushNotificationView ()

@property (nonatomic, strong) UIImageView *logoImageView;
@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UILabel *messageLabel;
@end

@implementation PushNotificationView
- (instancetype)initWithFrame:(CGRect)frame andDescription:(NSString *)description {
    if (self = [super initWithFrame:frame]) {
        self.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:.65];
        self.logoImageView = [[UIImageView alloc] initWithImage:kImg(@"kuwo_logo")];
        [self addSubview:self.logoImageView];
        [self.logoImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self).offset(20);
            make.top.equalTo(self).offset(20);
            make.size.mas_equalTo(CGSizeMake(20, 20));
        }];
        self.titleLabel = [[UILabel alloc] init];
        self.titleLabel.font = KwFont(12);
        self.titleLabel.textColor = [UIColor whiteColor];
        self.titleLabel.text = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleDisplayName"];
        [self addSubview:self.titleLabel];
        [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.logoImageView);
            make.left.equalTo(self.logoImageView.mas_right).offset(10);
            make.right.equalTo(self).offset(-10);
        }];

        self.messageLabel = [[UILabel alloc] init];
        self.messageLabel.font = KwFont(12);
        self.messageLabel.textColor = [UIColor whiteColor];
        self.messageLabel.text = description;
        [self addSubview:self.messageLabel];
        [self.messageLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.titleLabel.mas_bottom).offset(3);
            make.left.equalTo(self.titleLabel);
            make.bottom.equalTo(self.mas_bottom).offset(-10);
        }];

    }
    return self;
}
@end
